<?php /* Smarty version 2.6.26, created on 2011-01-10 16:06:44
         compiled from admin/_menu.html */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'math', 'admin/_menu.html', 47, false),)), $this); ?>
<?php echo '
<script type="text/javascript">
$(document).ready
(
    function()
    {
		$(\'div#top-menu-toggle\')
		    .css(\'cursor\',\'pointer\')
		    .click
		    (
			function()
			{
			    $(\'div#top-menu-content\')
				.slideToggle();
			}
		    );
    }
);
</script>
'; ?>


<!-- Верхнее ОСНОВНОЕ МЕНЮ -->
<div id="top-menu" style="position: fixed; margin-top: -10px; width: 98%; left: 1%; z-index: 999;">
    <div id="top-menu-content" style="display: none;" class="ui-widget ui-widget-header ui-corner-bottom">
	<table width="100%">
	    <tr>
		<td align="center">
		    <?php if ($_GET['action'] != 'task'): ?><a href="task.php" class="button">Задачи</a><?php endif; ?>
		    <?php if ($_GET['action'] != 'customer.list' && $_GET['action'] != ''): ?><a href="customer-list.php" class="button">Список клиентов</a><?php endif; ?>
		    <?php if ($_GET['action'] == 'customer.list' || $_GET['action'] == ''): ?>
		    <a href="javascript:void(0)" class="button" id="time-management-button">Тайм-менеджмент</a>
		    <a href="#" class="button" id="fields-tune">Настройка полей</a>
		    <?php endif; ?>
		    <?php if ($_SESSION['manager']['is_admin'] == 1): ?><a href="dictionary.php" class="button">Справочники</a><?php endif; ?>
		</td>
		<td align="right"><a href="logout.php" class="button">Выход</a></td>
	    </tr>
	</table>
    </div>
    <div id="top-menu-toggle" style="position: relative; width: 10%; left: 45%; text-align: center;" class="ui-widget ui-widget-header ui-corner-bottom">
	<a href="javascript:void(0)" id="menu-toggle">Меню</a>
    </div>
</div>

<?php if ($_SESSION['manager']['first_login']['being'] > 0 && $_SESSION['manager']['first_login']['being_reason'] == ''): ?>
<?php $this->assign('being', $_SESSION['manager']['first_login']['being']); ?>
<?php echo smarty_function_math(array('equation' => "x/60",'x' => $this->_tpl_vars['being'],'format' => "%d",'assign' => 'hours'), $this);?>

<?php echo smarty_function_math(array('equation' => "x%60",'x' => $this->_tpl_vars['being'],'format' => "%d",'assign' => 'mins'), $this);?>

<?php echo '
<script type="text/javascript">
$(document).ready
(
    function()
    {
	$(\'div#being-reason\')
	    .dialog(\'option\',\'title\',\'Добро пожаловать!\')
	    .dialog
	    (
		\'option\',
		\'buttons\',
		{
		    \'OK\':	function()
				{
				    $.getJSON
				    (
					\'login.php\',
					{
					    id:		'; ?>
<?php echo $_SESSION['manager']['first_login']['id']; ?>
<?php echo ',
					    reason:	$(\'input#being-reason-text\').val()
					},
					function(json){if(json[\'code\']==200){$(\'div#being-reason\').dialog(\'close\');}}
				    );
				}
		}
	    )
	    .dialog(\'open\');
    }
);
</script>
'; ?>

<div class="dialog" id="being-reason">
Здравствуйте. Ваш первый вход в систему сегодня состоялся в <?php echo $_SESSION['manager']['first_login']['time']; ?>
<br/>
Это означает что Вы опоздали на <?php if ($this->_tpl_vars['hours'] > 0): ?><?php echo $this->_tpl_vars['hours']; ?>
 ч.,<?php endif; ?><?php if ($this->_tpl_vars['mins'] > 0): ?><?php echo $this->_tpl_vars['mins']; ?>
 мин.<?php endif; ?><br/>
Пожалуйста, укажите причину Вашего опоздания:<input type="text" id="being-reason-text"/>
</div>
<?php endif; ?>